package com.ruoyi.web.controller.teacher;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.domain.BaseSignalanalysisInfo;
import com.ruoyi.service.IBaseSignalanalysisInfoService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 信号分析Controller
 * 
 * @author wangzebing
 * @date 2025-06-23
 */
@RestController
@RequestMapping("/signalanalysisInfo")
public class BaseSignalanalysisInfoController extends BaseController
{
    @Autowired
    private IBaseSignalanalysisInfoService baseSignalanalysisInfoService;

    /**
     * 查询信号分析列表
     */
    @GetMapping("/list")
    public TableDataInfo list(BaseSignalanalysisInfo baseSignalanalysisInfo)
    {
        startPage();
        List<BaseSignalanalysisInfo> list = baseSignalanalysisInfoService.selectBaseSignalanalysisInfoList(baseSignalanalysisInfo);
        return getDataTable(list);
    }

    /**
     * 导出信号分析列表
     */
    @Log(title = "信号分析", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BaseSignalanalysisInfo baseSignalanalysisInfo)
    {
        List<BaseSignalanalysisInfo> list = baseSignalanalysisInfoService.selectBaseSignalanalysisInfoList(baseSignalanalysisInfo);
        ExcelUtil<BaseSignalanalysisInfo> util = new ExcelUtil<BaseSignalanalysisInfo>(BaseSignalanalysisInfo.class);
        util.exportExcel(response, list, "信号分析数据");
    }

    /**
     * 获取信号分析详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(baseSignalanalysisInfoService.selectBaseSignalanalysisInfoById(id));
    }

    /**
     * 新增信号分析
     */
    @Log(title = "信号分析", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BaseSignalanalysisInfo baseSignalanalysisInfo)
    {
        return toAjax(baseSignalanalysisInfoService.insertBaseSignalanalysisInfo(baseSignalanalysisInfo));
    }

    /**
     * 修改信号分析
     */
    @Log(title = "信号分析", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BaseSignalanalysisInfo baseSignalanalysisInfo)
    {
        return toAjax(baseSignalanalysisInfoService.updateBaseSignalanalysisInfo(baseSignalanalysisInfo));
    }

    /**
     * 删除信号分析
     */
    @Log(title = "信号分析", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(baseSignalanalysisInfoService.deleteBaseSignalanalysisInfoByIds(ids));
    }
}
